-- @owner: zou_jialiang050
-- @date: 2024-15-06
-- @testpoint: 参数外使用算术运算符测试，部分测试点合理报错

--step1:建表;expect:成功
drop sequence if exists seq_ustore_regr_slope_017;
create sequence seq_ustore_regr_slope_017 increment by 1 start with 10;
drop table if exists t_ustore_regr_slope_017 cascade;
create table  t_ustore_regr_slope_017(
     col_1 integer,
     col_2 number(19,0),
     col_3 number(10,6)
) with (storage_type=ustore);

begin
	for i in 1..50 loop
      insert into t_ustore_regr_slope_017 values(
	  i,
      seq_ustore_regr_slope_017.nextval,
	  i+445.255
	  );
    end loop;
end;
/

--step2:函数内部使用比较表达式;expect:部分测试点合理报错
select regr_slope(case when col_2<20  then col_1 else col_2 end) from t_ustore_regr_slope_017 order by 1;
select regr_slope(case when col_2<20  then col_1 else col_2 end,case when col_2<20  then col_1 else col_2 end) from t_ustore_regr_slope_017 order by 1;
select regr_slope(case when col_3>100 then col_2 else col_3 end) from t_ustore_regr_slope_017 order by 1;
select regr_slope(case when col_3>100 then col_2 else col_3 end,case when col_3>100 then col_2 else col_3 end) from t_ustore_regr_slope_017 order by 1;

--step3:清理环境;expect:成功
drop sequence if exists seq_ustore_regr_slope_017 cascade;
drop table if exists t_ustore_regr_slope_017 cascade;